 /***************************************************************************
 *   Copyright (C) 2010 by ZhangShine , All Rights Reserved                                  
 *   zhangshine0125@gmail.com                                              
 *                                                                         
 *   This program is free software; you can redistribute it and/or modify  
 *   it under the terms of the GNU General Public License as published by  
 *   the Free Software Foundation; either version 2 of the License, or     
 *   (at your option) any later version.                                   
 *                                                                         
 *   This program is distributed in the hope that it will be useful,       
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
 *   GNU General Public License for more details.                          
 *                                                                         
 *   You should have received a copy of the GNU General Public License     
 *   along with this program; if not, write to the                         
 *   Free Software Foundation, Inc.,                                       
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             
 ***************************************************************************/

#ifndef SENDSTATUSDIALOG_H
#define SENDSTATUSDIALOG_H

#include <QDialog>
#include <QtCore>
#include "status.h"
#include "dealwebkitevent.h"
#include "emotion.h"
#include "account.h"

namespace Ui {
    class SendStatusDialog;
}

/*! \class SendStatusDialog
 * \brief 发送微博
 *
 * 目前比较乱
 */
class SendStatusDialog : public QDialog
{
    Q_OBJECT

public:
    SendStatusDialog(Account *account);//发表新微博
    SendStatusDialog(Account *account,QString &retwId, QString &appendText);//转发微博
    SendStatusDialog(Account *account, QString &commentStatusId);//评论微博
    SendStatusDialog(Account *account, QString &cid, QString &id, int dialogType);//回复评论
    SendStatusDialog(Account *account, QString uid, int dialogType);//发送私信
    ~SendStatusDialog();
    
public slots:
    void sendButtonClicked();
    void trendsButtonClicked();
    void addPictureButtonClicked();
    void wordsCount();
    void addEmotionClicked();
    void addJavaScriptObject();
    void setHtmlByRow(QModelIndex modelIndex);
    void insertPhaseText(QString phase);
    void deletePicture();

    void sendStatus(QString statusText);
    void sendStatus(QString statusText, QByteArray pictureDataInByteArray, QString fileName);
    void repost(QString id, QString text);
    void commentStatus(QString id, QString text);
    void replyComment(QString cid, QString id, QString text);
    void sendDirectMessage(QString uid, QString text);
    
    void setText(QString text);
signals:
    
private:
    Account *account;
    Ui::SendStatusDialog *ui;
    DealWebkitEvent *dealWebkitEvent;
    QString emotionListToHtml(QList<Emotion> &list);
    QList<Emotion> getEmotionListByCategoryName(QString categoryName);
    int dialogType;/* 0---SendStatus  1-----RetwStatus  2-----Comment */
    QString pictureFileName;
    QByteArray pictureInByteArray;
    int wordsLimit;
    QString id;
    QString cid;
    
    void setHtml(int row);
};

#endif // SENDSTATUSDIALOG_H
